package com.hzit.cart.api;

import com.hzit.cart.api.domain.Address;
import com.hzit.cart.api.domain.Order;
import com.hzit.cart.api.domain.OrderItem;
import com.hzit.cart.api.domain.PayLog;
import com.hzit.cart.api.factory.RemoteCartFallback;
import com.hzit.cart.api.model.ItemVo;
import com.hzit.common.constant.HZitServiceNameConstants;
import com.hzit.manager.api.factory.RemoteContentFallback;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

@FeignClient(value= HZitServiceNameConstants.CART_SERVICE,fallbackFactory = RemoteCartFallback.class)
public interface RemoteCartService {

	//1. 查询当前登录的用户地址列表
	@GetMapping("/address/list")
	R<List<Address>> addressList();

	@GetMapping("/cart/findCart")
	R<Map<String,List<ItemVo>>> findCart();

	@PostMapping("/order/saveOrder")
	R saveOrder(Order order);


	@PostMapping("/orderItem/save")
	R saveOrderItem(OrderItem orderItem);

	@PostMapping("/payLog/save")
	R savePayLog(PayLog payLog);

	@GetMapping("/order/{login}")
	R<List<Order>> getOrderList(@PathVariable("login") String login);

	@GetMapping("/payLog/{out_trade_no}")
	R<PayLog> findPayLog(@PathVariable("out_trade_no") String out_trade_no);

	@PostMapping("/payLog/update")
	R updatePayLog(@RequestBody PayLog payLog);

	@PutMapping("/order/update/{id}/{status}")
	R updateOrder(@PathVariable("id") String id, @PathVariable("status") String status);
}
